<template>
    <div class="home">
        <div style="outline: 1px solid orange; padding: 15px; margin-top: 15px">
            <h2>子级</h2>
            <button @click="aaa++">{{ aaa }} ++</button>
            <grandchild></grandchild>
        </div>
    </div>
</template>

<script lang="ts">
// defineComponent 函数，目的是定义一个组件，内部可传入一个配置对象
import { defineComponent, inject } from "vue";
import grandchild from "./grandchild.vue";
export default defineComponent({
    name: "Home",
    components: {
        grandchild,
    },
    setup() {
        let aaa = inject("aaa");
        return {
            aaa,
        };
    },
});
</script>
